/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package jobs.model;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Paul Tamayo
 */
@Entity
@Table(name = "jobs")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Jobs.findAll", query = "SELECT j FROM Jobs j"),
    @NamedQuery(name = "Jobs.findById", query = "SELECT j FROM Jobs j WHERE j.id = :id"),
    @NamedQuery(name = "Jobs.findByPuntos", query = "SELECT j FROM Jobs j WHERE j.puntos = :puntos"),
    @NamedQuery(name = "Jobs.findByName", query = "SELECT j FROM Jobs j WHERE j.name = :name"),
    @NamedQuery(name = "Jobs.findByMission", query = "SELECT j FROM Jobs j WHERE j.mission = :mission"),
    @NamedQuery(name = "Jobs.findByDescription", query = "SELECT j FROM Jobs j WHERE j.description = :description")})
public class Jobs implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id")
    private Integer id;
    @Basic(optional = false)
    @NotNull
    @Column(name = "puntos")
    private int puntos;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 150)
    @Column(name = "name")
    private String name;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 500)
    @Column(name = "mission")
    private String mission;
    @Size(max = 200)
    @Column(name = "description")
    private String description;
    @ManyToMany(mappedBy = "jobsCollection")
    private Collection<BehavioralSkill> behavioralSkillCollection;
    @JoinColumn(name = "unit_id", referencedColumnName = "id")
    @ManyToOne(optional = false)
    private Unit unitId;
    @JoinColumn(name = "scope_id", referencedColumnName = "id")
    @ManyToOne(optional = false)
    private Scope scopeId;
    @JoinColumn(name = "rol_id", referencedColumnName = "id")
    @ManyToOne(optional = false)
    private Rol rolId;
    @JoinColumn(name = "occupational_group_id", referencedColumnName = "id")
    @ManyToOne(optional = false)
    private OccupationalGroup occupationalGroupId;
    @JoinColumn(name = "level_id", referencedColumnName = "id")
    @ManyToOne(optional = false)
    private Level levelId;
    @JoinColumn(name = "interface_id", referencedColumnName = "id")
    @ManyToOne(optional = false)
    private Interface interfaceId;
    @JoinColumn(name = "institution_id", referencedColumnName = "id")
    @ManyToOne(optional = false)
    private Institution institutionId;
    @JoinColumn(name = "grade_id", referencedColumnName = "id")
    @ManyToOne(optional = false)
    private Grade gradeId;
    @JoinColumn(name = "formal_instruction_id", referencedColumnName = "id")
    @ManyToOne(optional = false)
    private FormalInstruction formalInstructionId;
    @JoinColumn(name = "experience_id", referencedColumnName = "id")
    @ManyToOne(optional = false)
    private Experience experienceId;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "jobsId")
    private Collection<Activity> activityCollection;

    public Jobs() {
    }

    public Jobs(Integer id) {
        this.id = id;
    }

    public Jobs(Integer id, int puntos, String name, String mission) {
        this.id = id;
        this.puntos = puntos;
        this.name = name;
        this.mission = mission;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public int getPuntos() {
        return puntos;
    }

    public void setPuntos(int puntos) {
        this.puntos = puntos;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getMission() {
        return mission;
    }

    public void setMission(String mission) {
        this.mission = mission;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    @XmlTransient
    public Collection<BehavioralSkill> getBehavioralSkillCollection() {
        return behavioralSkillCollection;
    }

    public void setBehavioralSkillCollection(Collection<BehavioralSkill> behavioralSkillCollection) {
        this.behavioralSkillCollection = behavioralSkillCollection;
    }

    public Unit getUnitId() {
        return unitId;
    }

    public void setUnitId(Unit unitId) {
        this.unitId = unitId;
    }

    public Scope getScopeId() {
        return scopeId;
    }

    public void setScopeId(Scope scopeId) {
        this.scopeId = scopeId;
    }

    public Rol getRolId() {
        return rolId;
    }

    public void setRolId(Rol rolId) {
        this.rolId = rolId;
    }

    public OccupationalGroup getOccupationalGroupId() {
        return occupationalGroupId;
    }

    public void setOccupationalGroupId(OccupationalGroup occupationalGroupId) {
        this.occupationalGroupId = occupationalGroupId;
    }

    public Level getLevelId() {
        return levelId;
    }

    public void setLevelId(Level levelId) {
        this.levelId = levelId;
    }

    public Interface getInterfaceId() {
        return interfaceId;
    }

    public void setInterfaceId(Interface interfaceId) {
        this.interfaceId = interfaceId;
    }

    public Institution getInstitutionId() {
        return institutionId;
    }

    public void setInstitutionId(Institution institutionId) {
        this.institutionId = institutionId;
    }

    public Grade getGradeId() {
        return gradeId;
    }

    public void setGradeId(Grade gradeId) {
        this.gradeId = gradeId;
    }

    public FormalInstruction getFormalInstructionId() {
        return formalInstructionId;
    }

    public void setFormalInstructionId(FormalInstruction formalInstructionId) {
        this.formalInstructionId = formalInstructionId;
    }

    public Experience getExperienceId() {
        return experienceId;
    }

    public void setExperienceId(Experience experienceId) {
        this.experienceId = experienceId;
    }

    @XmlTransient
    public Collection<Activity> getActivityCollection() {
        return activityCollection;
    }

    public void setActivityCollection(Collection<Activity> activityCollection) {
        this.activityCollection = activityCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Jobs)) {
            return false;
        }
        Jobs other = (Jobs) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "jobs.jpa.Jobs[ id=" + id + " ]";
    }
    
}
